package com.sunrise.xdoc.entity.config;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.sunrise.xdoc.entity.AbstractCodeEntity;
import com.sunrise.xdoc.entity.user.User;

/**
 * Luu thong tin chi nhanh.
 * 
 */
@Entity
@Table(name = "config_chi_nhanh")
@Inheritance(strategy = InheritanceType.JOINED)
public class ChiNhanh extends AbstractCodeEntity {
	private static final long serialVersionUID = 1L;
	private String name;
	private String address;
	private String phone;
	private String fixPhone;
	private User orgDirector;

	@Column(name = "name", unique = true)
	@Length(max = 250)
	@NotBlank
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "address")
	@Length(max = 1024)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "phone")
	@Length(max = 20)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "fixPhone")
	@Length(max = 20)
	public String getFixPhone() {
		return fixPhone;
	}

	public void setFixPhone(String fixPhone) {
		this.fixPhone = fixPhone;
	}

	// TODO Bang: change to NhanVien
	@ManyToOne
	@JoinColumn(name = "director_id")
	public User getOrgDirector() {
		return orgDirector;
	}

	public void setOrgDirector(User orgDirector) {
		this.orgDirector = orgDirector;
	}

}
